package com.ynny.Service;

import com.ynny.Dao.ScoreManagerDao;
import com.ynny.Entity.Scores;
import com.ynny.Service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ScoreServiceImpl implements ScoreService {
    @Autowired
    private ScoreManagerDao scoreManagerDao;
    @Override
    public int updateScore(String number, String course, Double score) {//修改/更新成绩
        //根据学号更新对应的课程成绩
        int i = scoreManagerDao.updateScore(number, course, score);
        if (i > 0){
            return i;
        }else return 0;//数据更新失败
    }

    @Override
    public List<Scores> queryAllScore() {
        return scoreManagerDao.queryAllScore();
    }

    @Override
    public Scores queryScoreByNumber(String number) {
        return scoreManagerDao.queryScoreByNumber(number);
    }

    @Override
    public int addScore(String number, String course, Double score) {
        return scoreManagerDao.addScore(number, course, score);
    }
}
